<%@ page pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>
<%@ page import="com.hwhp.entity.*"%>
<%@include file="/html/common/taglibs.jsp"%>
<%@page import="com.hwhp.common.Pager" %>
<%
	
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"+ request.getServerName() + ":" + request.getServerPort()+ path + "/";
	Pager pager = (Pager)request.getAttribute("page");
	List psList = new ArrayList();
	if(pager == null){
		pager = new Pager();
			
	}else{
		psList = pager.getElements();
	}
	
%>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>职务管理</title>
		<LINK href="<%=basePath%>css/milkwhite.css" type=TEXT/CSS
			rel=StyleSheet></LINK>
		<LINK href="<%=basePath%>css/htmilkwhite.css" type=TEXT/CSS
			rel=StyleSheet></LINK>
		<LINK href="<%=basePath%>css/dhtmlxgrid.css" type=TEXT/CSS
			rel=StyleSheet></LINK>
		<LINK href="<%=basePath%>js/tree/dtree/dtree.css" type=text/css
			rel=StyleSheet>
		<SCRIPT src="<%=basePath%>js/tree/dtree/dtree.js" type=text/javascript></SCRIPT>
		<SCRIPT src="<%=basePath%>js/list/dhtmlxcommon.js"
			type=text/javascript></SCRIPT>
		<SCRIPT src="<%=basePath%>js/list/dhtmlxgrid.js" type=text/javascript></SCRIPT>
		<SCRIPT src="<%=basePath%>js/list/dhtmlxgridcell.js"
			type=text/javascript></SCRIPT>
		<SCRIPT src="<%=basePath%>js/list/dhtmlxgrid_start.js"
			type=text/javascript></SCRIPT>
	</head>
	<%
						

	%>
	<BODY style="MARGIN: 0px; OVERFLOW: visible">
		<FORM id="formlist" name="formlist" action="" method="post">
			<TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%"
				border=0>
				<TBODY>
					<TR>
						<TD height=20></TD>
						<TD height=20></TD>
						<TD height=20></TD>
					</TR>
					<TR>
						<TD class=middlelinel></TD>
						<TD height=20>
							<!-- 搜索 -->
							<TABLE cellSpacing=0 cellPadding=0 border=0 width="100%">
								<TBODY>
									<TR>
										<TD style="WIDTH: 70px" align=right>
											人员名称:
										</TD>
										<TD style="WIDTH: 80px" align=right>
											<INPUT id=title name=title>
										</TD>
										<TD style="WIDTH: 8px"></TD>
										<TD class=searchheight>
											<TABLE class=button onmouseover="this.className='buthot'"
												onmouseout="this.className='button'" cellSpacing=0
												cellPadding=0 border=0>
												<TBODY>
													<TR onclick=document.forms[0].submit();>
														<TD class=buttoncelerity></TD>
														<TD class=buttonmiddle>
															检索
														</TD>
														<TD class=buttonright></TD>
													</TR>
												</TBODY>
											</TABLE>
										</TD>
										<TD width=5></TD>
										<TD>
											<B>1/0</B> 共
											<B>0</B> 条
										</TD>
										<TD vAlign=top align="right">
											<table border='0' cellpadding='2' cellspacing='0'>
												<tr height="20">
													<td
														style='background-image:url(<%=basePath%>images/button/w_buttoncelerity1.gif);width:22px;'></td>
													<td
														style='background-image:url(<%=basePath%>images/button/w_buttonmiddle1.gif);cursor: hand;'>
														<a href="/chis/manager/position!insertPs.action?act=add">新增</a>
													</td>
													<td
														style='background-image:url(<%=basePath%>images/button/w_buttonright1.gif);width:6px;'></td>
													<td
														style='background-image:url(<%=basePath%>images/button/w_buttonclose1.gif);width:22px;'></td>
													<td
														style='background-image:url(<%=basePath%>images/button/w_buttonmiddle1.gif);cursor: hand;'
														onclick="updateProcess()">
														修改
													</td>
													<td
														style='background-image:url(<%=basePath%>images/button/w_buttonright1.gif);width:6px;'></td>
													<td
														style='background-image:url(<%=basePath%>images/button/w_buttondelete1.gif);width:22px;'></td>
													<td
														style='background-image:url(<%=basePath%>images/button/w_buttonmiddle1.gif);cursor: hand;'
														onclick="deleteProcess()">
														删除
													</td>
													<td
														style='background-image:url(<%=basePath%>images/button/w_buttonright1.gif);width:6px;'></td>
												</tr>
											</table>
										</TD>
									</TR>
								</TBODY>
							</TABLE>
						</TD>
						<TD class=middleliner></TD>
					</TR>
					<TR>
						<TD class=middlelinel></TD>
						<TD
							style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid"
							vAlign=top>
							<TABLE class=dhtmlxGrid id=gridbox height="100%" width="100%">
								<TBODY>
									<TR>
									    <TD noWrap type="ro" style="width:30">
									       <INPUT class="input3" id="alldepartid" name="departid" value="" type="checkbox" />
										</TD>
									    <TD noWrap type="ro" style="width:50">
									                    名称
										</TD>
										<TD noWrap type="ro">
											父名称
										</TD>
										<TD noWrap type="ro">
											类型
										</TD>
										<TD noWrap type="ro">
											操作
										</TD>
									</TR>
									<%
										for(Object o : psList ){
											SPosition sp = (SPosition)o;
									 %>
									<TR>
									    <TD noWrap style="width:30">
									       <INPUT class="input3" id="edepartid" name="edepartid" value="<%=sp.getPositionId()%>" type="checkbox">
										</TD>
									    <TD noWrap align="center">
									    	<%=sp.getName()%>
										</TD>
										<TD noWrap>
											<%=sp.getParentSposition().getName()%>
										</TD>
										<TD noWrap>
											<%=sp.getType()%>
										</TD>
										<TD noWrap align="center">
											<img src="<%=basePath%>images/button/edit.gif" style="cursor: hand" onclick="editProcess('<%=sp.getPositionId()%>')">&nbsp;&nbsp;
											<img src="<%=basePath%>images/button/del.gif" title="删除" style="cursor: hand" onclick="deleteProcess('<%=sp.getPositionId()%>')">
										</TD>
									</TR>
									<%
										}
									 %>
									 
								</TBODY>
							</TABLE>
						</TD>
					<TD class=middleliner></TD>
					</TR>
					<TR>
						<TD class=middlebottoml></TD>
						<TD class=middlebottomm></TD>
						<TD class=middlebottomr></TD>
					</TR>
				</TBODY>
			</TABLE>
		</FORM>
	</BODY>
	<SCRIPT type=text/javascript>
		function editProcess(spId){
		  formlist.action="/chis/manager/position!insertPs.action?spId="+spId+"&act=edit";
		  formlist.submit();
		}
		
		function deleteProcess(spId){
		  if(confirm("are you sure delete?")){
			  formlist.action="/chis/manager/position!deletePs.action?spId="+spId;
		  	  formlist.submit();
	      }
		}
		
		function updateProcess(){
			var spId = document.getElementsByName("edepartid");
			for(var i = 0 ; i < spId.length ; i++){
				if(spId[i].checked == true){
						alert(i);
				}
			} 
				//document.getElementById("edepartid").value;
			alert(spId);
	    }
		
	</SCRIPT>
</HTML>

